/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package db;


import java.sql.*;

/**
 *
 * @author demian
 */
public class QueryDB {
    
    String nombre, tiempo;
    
    public void cargarTopTen(String nombre, String tiempo) throws SQLException {
        
        Connection connection = ConexionDB.getInstance();
        
        String query = "INSERT INTO topten VALUES ('"+nombre+"','"+tiempo+"')";
        Statement stm = connection.createStatement();
        stm.executeUpdate(query);
        
    }
    
    
    public ResultSet obtenerTopTen() throws SQLException {
        Connection connection = ConexionDB.getInstance();
        String query = "SELECT nombre,tiempo FROM topten ORDER BY tiempo ASC LIMIT 10";
        Statement stm = connection.createStatement();
        
        ResultSet rs = stm.executeQuery(query);
        
        return rs;
    }
    
}
